package cn.net.withub.dataCollector.web.collector;

import cn.edu.hfut.dmic.webcollector.crawler.Crawler;
import cn.net.withub.dataCollector.common.model.TCollectorConfig;
import org.springframework.web.context.WebApplicationContext;

public class CrawlerFactory {
    public static Crawler createCrawler(String crawlPath, boolean autoParse, WebApplicationContext wac, TCollectorConfig config) throws Exception {
        Crawler crawler = null;
        int id = config.getId();
        switch (id) {
            case 149:case 150:case 151:case 152://最高法院内网新闻
                crawler = new CollectorUtilsZgfnw(crawlPath, autoParse, wac, config);
                break;
            case 153://新浪网 国内新闻
                crawler = new CollectorUtilsSina(crawlPath, autoParse, wac, config);
                break;
            case 154://腾讯网新闻
                crawler = new CollectorUtilsTx(crawlPath, autoParse, wac, config);
                break;
            case 155://新华网新闻
                crawler = new CollectorUtilsXhw(crawlPath, autoParse, wac, config);
                break;
        }
        return crawler;
    }
}
